package com.edu.exam.enums.grading;

import com.edu.exam.enums.core.BaseEnum;

/**
 * 业务影响级别枚举
 */
public enum BusinessImpactLevel implements BaseEnum {
    LOW("LOW", "低影响"),
    MEDIUM("MEDIUM", "中等影响"),
    HIGH("HIGH", "高影响"),
    CRITICAL("CRITICAL", "严重影响"),
    BLOCKER("BLOCKER", "阻塞影响"),
    INFO("INFO", "信息级别"),
    WARNING("WARNING", "警告级别"),
    ERROR("ERROR", "错误级别");

    private final String code;
    private final String description;

    BusinessImpactLevel(String code, String description) {
        this.code = code;
        this.description = description;
    }

    @Override
    public String getCode() {
        return code;
    }

    @Override
    public String getDescription() {
        return description;
    }

    public static BusinessImpactLevel fromCode(String code) {
        for (BusinessImpactLevel level : values()) {
            if (level.getCode().equals(code)) {
                return level;
            }
        }
        return LOW; // 默认返回低影响
    }
}